package tbdp.tas.model

/**
  * Created by xbkaishui on 16/9/5.
  */
class MinsLine extends Serializable {

  //产品代码
  var sCode: String = null
  //产品名称
  var sCodeName: String = ""
  //市场分类
  var marketType: String = "9"
  //总手(总成交量)
  var vol: Long = 0
  //金额(总成交金额)
  var amt: Double = 0.0
  //成交数量
  var inc_vol: Long = 0
  //成交金额
  var inc_amt: Double = 0.0

  //昨日收盘价
  var yClose: Double = 0.0
  //今日开盘价
  var aOpen: Double = 0.0
  //今日最高价
  var aHigh: Double = 0.0
  //今日最低价
  var aLow: Double = 0.0
  //今日收盘价
  var aClose: Double = 0.0
  //今日最新价
  var aTrade: Double = 0.0
  //证券类型
  var codeType: String = null
  //是否为指数
  var isExp: Int = 0

  var tradingPhaseCode: String = null
  var timestamp: String = null

  //机构总买量
  var agencyBVol: Long = 0
  //机构总买额
  var agencyBAmt: Double = 0
  //总买量
  var allBVol: Long = 0
  //总买额
  var allBAmt: Double = 0
  //机构总卖量
  var agencySVol: Long = 0
  //机构总卖额
  var agencySAmt: Double = 0
  //总卖量
  var allSVol: Long = 0
  //总卖额
  var allSAmt: Double = 0

  //机构拉升分值
  var agencyBSco: Int = 0
  //机构杀跌分值
  var agencySSco: Int = 0
  //私募补仓分值
  var priTeamBSco: Int = 0
  //私募打压分值
  var priTeamSSco: Int = 0
  //散户跟风分值
  var publicBSco: Int = 0
  var publicSSco: Int = 0
  //行为资金综合分值
  var allSco: Int = 0

  //前5日行为资金综合分值
  var avg5AllSco: Int = 0

  //机构资金增减额_1日
  var agencyBSAmt1D: Double = 0
  //机构资金增减额_3日
  var agencyBSAmt3D: Double = 0
  //机构资金增减额_5日
  var agencyBSAmt5D: Double = 0
  //机构资金增减额_7日
  var agencyBSAmt7D: Double = 0
  var UpdateTime: String = null
  var TTime: String = null
  //分区时间(年)
  var partitionYear: String = null
  //分区时间(月)
  var partitionMonth: String = null
  //机构买筹码锁定率
  var agencyBVolRate: Double = 0
  //总买筹码锁定率
  var allBVolRate: Double = 0
  //机构卖筹码锁定率
  var agencySVolRate: Double = 0
  //总卖筹码锁定率
  var allSVolRate: Double = 0
  //1日机构筹码锁定率
  var agency1BSVolRate: Double = 0
  //3日机构筹码锁定率
  var agency3BSVolRate: Double = 0
  //5日机构筹码锁定率
  var agency5BSVolRate: Double = 0
  //10日机构筹码锁定率
  var agency10BSVolRate: Double = 0
  //20日机构筹码锁定率
  var agency20BSVolRate: Double = 0

  //总资金净流入_1日
  var all1BSAmt: Double = 0
  var all3BSAmt: Double = 0
  var all5BSAmt: Double = 0
  var all10BSAmt: Double = 0

  //数据是否有效
  var valid: Boolean = true
  /** *计算分时的累加数据 ***/
  //分时机构总买量
  var minBigVol: Long = 0
  //分时机构总额
  var minBigAmt: Double = 0
  //分时总买量
  var minAllVol: Long = 0
  //分时总额
  var minAllAmt: Double = 0
  /** *计算分时的累加数据 END ***/

  var oneVOL: Long = 0
  //逐笔交易额
  var oneAmt: Double = 0

  /** **计算实时行情指标 ****/
  //内盘成交量
  var innerVol: Long = 0
  //外盘成交量
  var outerVol: Long = 0
  //买卖标记
  var bOrSFlag: Int = 0
  //止盈价
  var SProfitPrice: Double = 0
  //止损价
  var sLossPrice: Double = 0
  /** **计算实时行情指标 END ****/
  var updateTime: String = null

  //筹码锁定率当日增幅 筹码锁定率每日增幅=(今日筹码锁定率－前1日筹码锁定率)÷昨日筹码锁定率*100%
  var aLLVolRate: Double = 0.0

  /** *top 分值字段列表 ****/
  //top 分值
  var score: Double = 0.0
  //昨日TOP分值
  var yScore: Double = 0.0
  //TOP排名
  var train: Int = 0
  //昨日TOP排名
  var yTrain: Int = 0
  //TOP分值总个数
  var scoreCnt: Int = 0

  /** **临时变量 */
  var rise5toExp: Double = 0.0
  var rise20toExp: Double = 0.0

  var score5: Double = 0.0
  var score20: Double = 0.0

  /** 按分钟均值计算的交易总量 */
  var minsCnt: Int = 0
  //前五日平均每分钟成交量
  var avg5PerMinsVol: Int = 0

  //是否收盘标记
  var tflag: String = "0"
  var tDate: String = null

  //增加 select stock 字段
  var dynamicVal: Int = 0
  var topData1: Double = 0
  var topData3: Double = 0
  var topData5: Double = 0

  var yAgency1BSVolRate: Double = 0

  //筹码排名,根据筹码锁定率逆序排列
  var agency1BSVolRateTrain: Int = 0
  //昨日筹码排名,根据筹码锁定率逆序排列
  var yAgency1BSVolRateTrain: Int = 0
  override def toString = s"MinsLine($sCode, $marketType,$agencyBSco ,$agencySSco,$priTeamBSco,$priTeamSSco,$publicBSco,$publicSSco,$allSco)"
}

object MinsLine {

  def fromBk(bk: StockBlock): MinsLine = {
    val min = new MinsLine
    min.marketType = "9"
    min.codeType = "9"
    min.sCode = bk.bCode
    min.sCodeName = bk.bName
    min
  }
}
